package forum.service;

import forum.dao.ReplyDao;
import forum.dao.SectionDao;
import forum.dao.TopicDao;
import forum.dao.UserDao;
import forum.model.Reply;
import forum.model.ReplyListResult;
import forum.model.SectionListResult;
import forum.model.User;

/**
 * @author haomin
 * @date 2022/07/01 16:35
 **/
public class ReplyService {
    public ReplyListResult replyListResult (User currentUser,int tid){
        ReplyDao replyDao = new ReplyDao();
        ReplyListResult result = new ReplyListResult();

        result.currentUser = currentUser;
        if(currentUser != null){
            result.pointCount = new UserDao().selectPointCountByUid(currentUser.uID);
            result.classCount = new UserDao().selectClassCountByUid(currentUser.uID);
            result.topic = new TopicDao().selectTopicByTid(tid);
            result.replyList = replyDao.selectListByTid(tid);
        }
        return result;
    }
}